trayicon-x11: Refactor code a bit
authorBenjamin Otte <otte@redhat.com>
Sun, 28 Aug 2011 18:19:55 +0000 (20:19 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 28 Aug 2011 18:20:35 +0000 (20:20 +0200)
Should make it more obvious what the code actually does.

gtk/gtktrayicon-x11.c

index f31b58e2db2e5671584b3240904db314396d6d49..d4f0706c6801c60d80a9b6d2590731b3b52a95f3 100644 (file)
@@ -479,9 +479,6 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
   gulong bytes_after;
   int error, result;
   GdkVisual *visual;
-  gint red_prec;
-  gint green_prec;
-  gint blue_prec;
 
   g_assert (icon->priv->manager_window != None);
 
@@ -507,14 +504,18 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
 
   if (visual != NULL)
     {
+      gint red_prec, green_prec, blue_prec;
+
       gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
       gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
       gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+      icon->priv->manager_visual_rgba =
+          (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual));
     }
+  else
+    icon->priv->manager_visual_rgba = FALSE;
 
   icon->priv->manager_visual = visual;
-  icon->priv->manager_visual_rgba = visual != NULL &&
-    (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual));
 
   /* For the background-relative hack we use when we aren't using a real RGBA
    * visual, we can't be double-buffered */